$('.btn').onclick = async function () {
    const username = $('.username').value;
    const password = $('.password').value

    if (username && password) {

        const res = await login({
            username,
            password
        })
        console.log(res);

        const {
            status,
            msg
        } = res;

        if ($('.xz').checked) {

            if (status) {
                alert("登录成功")
                localStorage.setItem('login_user', username);
                location.href = 'http://127.0.0.1/mi/%e5%b0%8f%e7%b1%b3/mi.html';
            } else {
                $('.username_span').innerHTML = "用户不存在";
                $('.username_span').style.color = "red";
                $('.username_span').style.fontSize = "14px";
            }
        } else {
            alert("请勾选协议!")
        }

    }
}